home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / GAMES / MONOPOLY.ARC / !DataSuite / Docs / DtVoxHelp < prev   
Text File  |  1994-06-26  |  68KB  |  1,446 lines

  1.  
  2.  DataVox Help File.
  3.  ==================
  4.  
  5.  NB If you are using this module under Risc OS kernel version 2.00 then you
  6.     must have IRQutils module v0.9 or greater loaded! This is because
  7.     DataVox makes heavy usage of transient call backs and the 2.00 kernel
  8.     routines have an error in them that IRQutils fixes. Failure to load
  9.     this module can result in address exceptions and your machine crashing!
  10.  
  11.    This module will play chunks of memory through the sound system with the
  12.  emphasis on being able to customise dynamically how it plays. It provides
  13.  several SWI's and * commands for it's control. It is to be noted that
  14.  while the voice can handle a large variety of types of data it cannot
  15.  handle 16 bit data *only* 8 bit data. If demand is high enough I will
  16.  update this module to handle 16 bit data but it will increase its size
  17.  somewhat dramatically! (Which is why I have not included it...)
  18.    The newest feature of this module is complete system speed independance
  19.  of playing of sounds. Code has been written into this module to ensure
  20.  that it will always *attempt* to play a sound at its correct pitch no
  21.  matter what the system speed (in micro seconds) is set to. Due to hardware
  22.  and software limitations this will not always sound terribly good but at
  23.  least it tries. This means your sample set to play nicely at the default
  24.  48 micro seconds (20.833 kHz) will still sound fine when a sound tracker
  25.  is playing, which bumps the system speed up to 34 micro seconds (29.411
  26.  kHz). As far as I am aware this is the first ever module on the Arc to
  27.  attempt this.
  28.    To use this module you use the SWI "DataVox_SetMemory" to set a channel
  29.  up for playing and issue sound commands after setting the appropriate 
  30.  data type using SWI "DataVox_Type". Easy eh? Nope? Well that is why I 
  31.  have bundled this module with its companion 'DataLoad' which provides
  32.  a nice OSCLI command interface for convienance. See the file DtLdHelp
  33.  for more information.
  34.  
  35.  The Concepts of DataVox
  36.  =======================
  37.  
  38.    DataVox is a module exclusively designed to play chunks of memory
  39.  through the sound system of the Arc. DataVox has no concept of files
  40.  or *anything* other than memory when it comes to playing and it has
  41.  been heavily geared towards this. The abstraction of files and loading/
  42.  saving of them etc.. has been kept away from DataVox for two reasons :-
  43.  
  44.  Size - Every effort has been made to keep DataVox as small as possible
  45.       while still retaining a friendly user interface. The other side
  46.       effect is that it helps to keep DataVox as fast as possible.
  47.  
  48.  Flexibility - Because DataVox has no concept of files etc... an application
  49.       can, with very little effort, bend DataVox to play files in any
  50.       manner it sees fit. This allows applications to do things like
  51.       playing compressed samples,playing from disk or just plain having
  52.       all the sound data to be played memory resident.
  53.  
  54.  As you can see this leaves DataVox a very flexible module, part of what
  55.  I set out to do with it.
  56.    The sound system provided on the Arc has two major concepts in it. That
  57.  of a channel and of a voice. DataVox provides a sound system *voice* that
  58.  provides an extra layer to the *channel* system. DataVox's voice allows
  59.  you to play differing things depending on what sound system channel is
  60.  attached to it and to this end provides it's own internal channel system.
  61.  A DataVox channel is a channel internal to DataVox and must not be confused
  62.  with a sound system channel.
  63.    Each DataVox channel is fully independant of all the other DataVox
  64.  channels and there is a direct one-to-one correspondence between DataVox
  65.  channels and sound system channels. That is from the sound system only
  66.  Operating System sound channel 1 can, when assigned to the DataVox Voice,
  67.  access DataVox channel 1, also OS channel 2 can only access DataVox channel
  68.  2,etc.... The layering goes something like this :-
  69.  
  70.   OS sound channels -----> Voices
  71.   (of which there are      WaveSynth-Beep
  72.    eight)                  ...
  73.                            Percussion-Noise
  74.                            DataVox-Voice ------> DataVox channels
  75.                                                  (of which there are eight-
  76.                                                  to allow a 1-1 matching
  77.                                                  with the OS channels)
  78.  
  79.   Each DataVox channel has information about what memory it is to play etc..
  80.   and these settings apply only to that one channel. Some of this infor-
  81.   mation is set out below.
  82.  
  83.   Channel Timed Pitched Type   Start     End       Rpt Start Rpt End   Rvse  
  84.      1     No    No      Log   &00000000 &00000000 &00000000 &00000000 No
  85.  
  86.  This is  Does  Does it The    The start The end   The start The end   Does
  87.  DataVox  it    use     Type   address   address   address   address   it
  88.  channel  play  fixed   of     in memory in memory in memory in memory play
  89.  and its  in    pitch   Data   of what   of what   of where  of where  the
  90.  `master' timed play?   to     to play.  to play.  to begin  to end    Data
  91.  channel. mode?         Play.                      repeating repeating Back-
  92.                                                    play of   play of   wards?
  93.                                                    the Data. the Data.
  94.  
  95.    Rate
  96.    &00
  97.  
  98.  The rate
  99.  in micro-
  100.  seconds 
  101.  the Data
  102.  is played
  103.  at.
  104.  
  105.  All of the settings listed above are reported to you by the *DataVoxStatus
  106.  command. Also stored about each channel is a key for multi-tasking access
  107.  , an address for UpCall code associated with the channel, where the voice
  108.  is up to in memory if the channel is playing & a toggling flag to indicate
  109.  which buffer is in use. For more details about precisely what all these
  110.  flags etc.. mean see the SWI command explanations.
  111.    The various SWI's provided can be divided into several groups based on
  112.  what there general function is. These groups are :-
  113.  
  114.  Setting Channel Data   - DataVox_Type
  115.                           DataVox_Timed
  116.                           DataVox_Pitch
  117.                           DataVox_SetMemory
  118.                           DataVox_SetRepeat
  119.                           DataVox_SetReverse
  120.                           DataVox_UpCallHandler
  121.                           DataVox_SlaveChannel
  122.                           DataVox_AdjustMemory
  123.  
  124.  These SWIs are how applications set the DataVox channel settings.
  125.  
  126.  Reading Channel Data   - DataVox_ReadType
  127.                           DataVox_ReadTimer
  128.                           DataVox_ReadPitch
  129.                           DataVox_ReadMemory
  130.                           DataVox_Repeat
  131.                           DataVox_ReadReverse
  132.                           DataVox_ReadMaster
  133.   
  134.  These SWIs are how applications read what the DataVox channel settings 
  135.  currently are.
  136.  
  137.  Monitoring Channels    - DataVox_ReadAddress
  138.                           DataVox_ReadBufferFlag
  139.  
  140.  These SWIs provide the means by which applications can do real time
  141.  monitoring of the play of data.
  142.  
  143.  Reading DataVox Status - DataVox_VoiceActive
  144.                           DataVox_SystemSpeed
  145.                           DataVox_Version
  146.  
  147.  These SWIs provide general status information about DataVox.
  148.  
  149.  Mulitasking Support    - DataVox_AllocateChannel
  150.                           DataVox_DeAllocateChannel
  151.                           DataVox_RequestChannel
  152.                           DataVox_ChannelsFree
  153.                           DataVox_ChannelFreeMap
  154.  
  155.  These SWIs provide the multi-tasking support of DataVox for applications
  156.  and should *always* be used by an application. See the section `Multi-
  157.  Tasking and DataVox' for more details.
  158.  
  159.  Application Support    - DataVox_PitchToSample
  160.                           DataVox_SampleToPitch
  161.                           DataVox_Duplicate
  162.                           DataVox_Unset
  163.                           DataVox_ConvertByte
  164.                           DataVox_ConvertArea
  165.  
  166.  And these SWIs provide application support to allow an application to
  167.  make use of the system speed independance of DataVox and to generally
  168.  make an applications life easier.
  169.    Okay and that about wraps up all the essential concepts of DataVox.
  170.  The whole idea of DataVox is to provide a consistant,multi-tasking
  171.  & highly flexible system of playing sound data on the Arc. Hopefully
  172.  the information I have given you here and a good reading of what is
  173.  presented below will allow you to make full use of the power of DataVox.
  174.  
  175.  Multi-Tasking and DataVox
  176.  =========================
  177.  
  178.    This module has a set of four SWI's built into it to allow easy and
  179.  smooth multitasking use of itself. These SWI's are AllocateChannel,
  180.  DeAllocateChannel,RequestChannel & ChannelsFree. Three of them require
  181.  the passing of a `Unique Key' to them. All this is is a 32 bit number of
  182.  some kind that is used to provide a measure of allocation security. This
  183.  ,when used wisely, allows an application to claim and use a channel happy
  184.  in the knowledge that it is the only `official' user of that channel.
  185.  It is recommended that the task handle number given to an application
  186.  by the Wimp be used as the key as this will be unique to that particular
  187.  instantation of the application. Of course if you have good reason not
  188.  to use the task handle number then any number will suffice.
  189.    However while an application can be reasonably secure in the knowledge
  190.  that once it has been allocated a channel it is the only application that
  191.  will `officially' own it, no such claims can be made on the settings of
  192.  the channel. This is due to maintaining backwards compatability and
  193.  problems with channel ownership by loader modules. The consequence of
  194.  this is that an application must check the settings before each use of
  195.  the channel. The exact strategy used will vary from application to
  196.  application.
  197.    The recommended procedure for applications using DataVox is as follows.
  198.  
  199.  For `fixed voice no.' applications :-
  200.  
  201.    START
  202.      |
  203.    Verify Sufficient channels are free for use.
  204.    Claim these channels.
  205.      |
  206.    Verify channel Settings---+
  207.    Use channel               |
  208.      |                       |
  209.      +-Loop as required------+
  210.      |
  211.    Deallocate the claimed channels
  212.      |
  213.     END
  214.  
  215.  For `dynamic voice no.' applications :-
  216.  
  217.    START
  218.      |
  219.    Verify Sufficient channels are free.--+
  220.    Claim these channels                  |
  221.    Use said channels                     |
  222.    Release these channels                |
  223.      |                                   |
  224.      +-Loop as required------------------+
  225.      |
  226.     END
  227.  
  228.   As can be seen the only major difference between the two application
  229.   stratageys is when the voices are claimed and released. These minor
  230.   shifts in place require radically different error handling and coding
  231.   however as the dynamic voice application can never make any assumptions
  232.   as to whether sufficient channels will be available for it to use at
  233.   any given time. Both of these stratageys ensure that the application
  234.   verifies the channels settings before use thus catering for possible
  235.   interference with these settings between wimp polls.
  236.     How often tasks need to verify that their channels are set correctly
  237.   will vary according to what the task does. Two main strategys spring
  238.   to mind 1) Check the settings every Wimp_Poll and reset them as needed.
  239.   2) Check the settings just before use is made of the channel (And
  240.   not before). The second strategy is the prefered method as it requires
  241.   less processor time to maintain.
  242.     Finally some tasks will need a particular channel to operate properely
  243.   and so the SWI RequestChannel has been provided. This allows an application
  244.   to request for a particular channel rather than simply asking for one and
  245.   getting any random channel back. Again the application will be turned down
  246.   if they do not own the channel (if it is claimed) so applications must be
  247.   prepared to cope with this.
  248.     Other than these guidelines usage of the channel is up to the 
  249.   application involved. Not following these guidlines is not a good idea
  250.   as this can result in applications `squabbling' over channels with the
  251.   unpredictable results that can result in. Also in no way will DataVox
  252.   ensure that the Arc's Sound System has a sufficient number of channels
  253.   active or that those channels are assigned to it. This is the
  254.   applications responsibility as the way the Sound System handles channels
  255.   may be revised in future releases of the OS. This way the module will
  256.   automatically cope with the new OS...
  257.  
  258.   N.B. I am well aware that the security afforded by the key system is
  259.   ridiculously simple to circumvent. It is not intended to provide a
  260.   secure system but is merely intended as an aid to tasks to allow them
  261.   to share the module in a consistent and easy manner. It is unlikely
  262.   that I will extend the security system to allow security over channel
  263.   settings, as this will destroy the backwards compatability the module
  264.   has with old code, unless I receive sufficient comment from people to
  265.   justify this alteration.
  266.  
  267.  OSCLI Commands
  268.  ==============
  269.  
  270.  *DataVoxPitch
  271.  This sets the fixed pitch of the data being played. Once this is set any 
  272.  sound commands issued to this datachannel will be fixed at this pitch. To 
  273.  return to normal pitching enter 0 as the pitch.
  274.  Syntax *DataVoxPitch <DataChannel> <-&7FFF-&7FFF>.
  275.  
  276.  *DataVoxStatus
  277.  This shows the status of the DataVox channels and their various parameters.
  278.  Syntax *DataVoxStatus.
  279.  
  280.  *DataVoxTimer
  281.  This sets whether the Voice Generator ignores the duration parameter of the
  282.  SOUND command. Enter 0 for no timer control and 1 for timer control.
  283.  Syntax *DataVoxTimer <DataChannel> <0|1>.
  284.  
  285.  *DataVoxType
  286.  This sets the type of data being played. Enter 0 for Logarithmic (Archimedes
  287.  native format),1 for Linear Unsigned (Macintosh & IBM), 2 for Linear Signed
  288.  (Armadeus,Atari St & Amiga) and 3 for Ulaw logarithmic format (Sun).
  289.  Syntax *DataVoxType <DataChannel> <0|1|2|3>.
  290.  
  291.  *DataVoxReverse
  292.  This sets the direction of play. On (1) for reverse play & Off (0) for
  293.  normal play.
  294.  Syntax *DataVoxReverse <DataChannel> <0|1>.
  295.   
  296.  *DataVoxDuplicate
  297.  This copies a DataChannel's settings across to another channel. This allows
  298.  you to have several channels sharing the same piece of sound data easily.
  299.  Note it is invalid to try and duplicate to the same channel number.
  300.  Syntax *DataVoxDuplicate <Source DataChannel> <Destination DataChannel>.
  301.  
  302.  *DataVoxUnset
  303.  This unsets a DataChannel, destroying all settings for that channel.
  304.  Syntax *DataVoxUnset <DataChannel>.
  305.  
  306.  SWI Commands
  307.  ============
  308.  
  309.    Here is the list of SWI commands provided by the DataVoxPlayer module.
  310.  It is to be noted that when an error occurs R0 is always corrupted and not
  311.  preserved as is indicated below. Also if you issue a SWI in the same chunk
  312.  range as DataVoxPlayer but is an unrecognised SWI the error "Unknown 
  313.  DataVox operation" will be returned. For all of these SWI's the interupt
  314.  status is unchanged,the processor is in SVC mode and they are not 
  315.  re-entrant. (Well actually some of them are but I haven't sorted out which
  316.  are yet.)
  317.  
  318.  DataVox_Type
  319.  On Entry:-
  320.  R0 DataChannel
  321.  R1 type to set it to
  322.  On Exit:-
  323.  R0 preserved
  324.  R1 preserved
  325.  Errors:-
  326.  Bad Settype parameters.
  327.  Use:- 
  328.       This SWI sets the data type for the DataVox channel passed to it. R1
  329.  should be 0 for logarithmic,1 for Linear Unsigned,2 for Linear Signed & 3 for
  330.  Ulaw logarithmic. The new data typing will take effect at the next sound
  331.  `start play' command.
  332.  
  333.  DataVox_Timed
  334.  On Entry:-
  335.  R0 DataChannel
  336.  R1 On(1)/Off(0) flag
  337.  On Exit:-
  338.  R0 preserved
  339.  R1 preserved
  340.  Errors:-
  341.  Bad Timer parameters.
  342.  Use:-
  343.       This sets whether the time parameter of a Sound command issued to the
  344.  DataVox channel will be used or not. A Value of 1 will set it,0 will unset
  345.  it.
  346.  
  347.  DataVox_Pitch
  348.  On Entry:-
  349.  R0 DataChannel 
  350.  R1 Pitch
  351.  On Exit:-
  352.  R0 preserved
  353.  R1 preserved
  354.  Errors:-
  355.  Bad Pitch parameters.
  356.  Use:-
  357.       This sets the fixed pitch of the sound channel. The values accepted
  358.  are the same as those used by the *SOUND command for pitch, -&7FFF-&7FFF.
  359.  Passing 0 in R1 turns the fixed pitching off and then the Voice responds
  360.  to *SOUND commands the same as normal.
  361.  
  362.  DataVox_ReadPitch
  363.  On Entry:-
  364.  R0 DataChannel
  365.  On Exit:-
  366.  R0 preserved
  367.  R1 Pitch on exit
  368.  Errors:-
  369.  Bad Read Pitch Channel.
  370.  Use:-
  371.       Not unsurprisingly this reads the pitch value for a channel. A value
  372.  of zero indicates no fixed pitching,any other value is the fixed pitch.
  373.  
  374.  DataVox_ReadTimer
  375.  On Entry:-
  376.  R0 DataChannel
  377.  On Exit:-
  378.  R0 preserved
  379.  R1 Timer Setting on exit
  380.  Errors:-
  381.  Bad Read Timer Channel.
  382.  Use:-
  383.       This returns the setting of the timer flag for a chanel. 0 means no
  384.  timing and any non zero value indicates that timing will be used. This
  385.  means that,when set,the timing parameter of *SOUND commands will be used.
  386.  Otherwise the sound will play until it reaches the end of playable data.
  387.  
  388.  DataVox_ReadType
  389.  On Entry:-
  390.  R0 DataChannel
  391.  On Exit:-
  392.  R0 preserved
  393.  R1 pitch of channel
  394.  Errors:-
  395.  Bad Read Type Channel.
  396.  Use:-
  397.       This returns the type of data to be played by a particular channel.
  398.  A value of 0 indicates Logarithmic data,1 Linear Unsigned and 2 Linear
  399.  Signed.
  400.  
  401.  DataVox_SetMemory
  402.  On Entry:-
  403.  R0 DataChannel
  404.  R1 DataStart
  405.  R2 DataEnd
  406.  On Exit:-
  407.  R0 preserved
  408.  R1 preserved
  409.  R2 preserved
  410.  Errors:-
  411.  Bad Set Memory parameters.
  412.  Use:-
  413.       This sets the chunk of memory that the channel will play. The only
  414.  check that this call makes is that the memory end pointer is indeed larger
  415.  than the memory start pointer. This means that any area in RAM can be played
  416.  . This call also resets the channels type to Logarithmic,timer to off,
  417.  reverse to off,the repeat section to be all of the sample & to normal 
  418.  (unfixed) pitching. The voice fill code is in a privileged processor mode
  419.  so *any* memory area can be played (Even the ROM space if you really want...
  420.  :-) ). You must be careful to ensure that the memory to be played is always
  421.  'there' when the voice generator needs it. This means that under the multi
  422.  tasking Wimp you must not store voice data in application space *unless* you
  423.  do not call Wimp_Poll until the sound has finished playing. Even then you
  424.  must ensure that no sound commands will be issued to that channel while your
  425.  application is paged out. If a sound request is received while the memory is
  426.  paged out an address exception will occur and the voice generator will halt
  427.  play in an undefined way. It can range from hanging the machine to merely 
  428.  halting play! Of course if you *really* want to be a smart alec you can
  429.  point it to physical memory which should always be there...but I don't 
  430.  recommend it as I haven't tried it and thus can't be sure it will work.
  431.  
  432.  DataVox_ReadMemory
  433.  On Entry:-
  434.  R0 DataChannel
  435.  On Exit:-
  436.  R0 preserved
  437.  R1 Start address of channel.
  438.  R2 End addresses of channel.
  439.  Errors:-
  440.  Bad Read Memory Channel.
  441.  Use:-
  442.       This reads the memory start and end address of the specified channel.
  443.  See DataVox_SetMemory for a more detailed account of what the results mean.
  444.  
  445.  DataVox_ReadAddress
  446.  On Entry:-
  447.  R0 DataChannel
  448.  On Exit:-
  449.  R0 preserved
  450.  R1 current address.
  451.  Errors:-
  452.  Bad Read Address Channel.
  453.  Use:-
  454.       This reads the current absolute address that the voice is currently
  455.  up to. If the voice is not playing at the time the SWI is called it will
  456.  return an address of zero. Address returned will *always* be between or
  457.  equal to the voice start address and the voice end address. This SWI is
  458.  a very useful one for timing programs. By waiting for the address returned
  459.  to become zero programs can wait till a particular sound sample has played.
  460.  It must be noted that the update of this address is only at the end of 
  461.  DMA buffer fills and thus will will jump up by the size of the DMA sound
  462.  buffer instead of byte wise. It is,  however,  updated at the start of
  463.  sound play immediately.
  464.  
  465.  DataVox_SetRepeat
  466.  On Entry:-
  467.  R0 DataChannel
  468.  R1 Repeat Start address
  469.  R2 Repeat End address
  470.  On Exit:-
  471.  R0,R1,R2 preserved
  472.  Errors:-
  473.  Bad Set Repeat Channel.
  474.  Bad Set Repeat Memory - Start above End.
  475.  Bad Set Repeat. Voice not active.
  476.  Use:-
  477.       This sets the Repeat address for the channel. Repeating occurs only
  478.  when the timed flag is set and the voice is required to keep playing for
  479.  longer than its play time by the time paramter sent via the sound command.
  480.  When a repeat is neccessary play will start from the sections pointed to
  481.  by these addresses. Note if play is set for reverse then any repeated
  482.  sections will also be played in reverse.
  483.       N.B. In an extension over older versions of DataPlay the Set Repeat
  484.  SWI will no longer require that the addresses passed be inside those set
  485.  by the Voice Start & End addresses. This is to allow you to perform
  486.  buffering if you so wish. Read the description of the SWI ReadBufferFlag
  487.  for more on this topic.
  488.  
  489.  DataVox_ReadRepeat
  490.  On Entry:-
  491.  R0 DataChannel
  492.  On Exit:-
  493.  R0 preserved
  494.  R1 Repeat Start address
  495.  R2 Repeat End address
  496.  Errors:-
  497.  Bad Read Repeat Channel.
  498.  Use:-
  499.       With this SWI you can read the repeat start and end addresses for the
  500.  specified channel.
  501.  
  502.  DataVox_SetReverse
  503.  On Entry:-
  504.  R0 DataChannel
  505.  R1 Bit Flag. 1 for reverse, 0 for normal play.
  506.  On Exit:-
  507.  R0,R1 preserved
  508.  Errors:-
  509.  Bad Set Reverse Channel.
  510.  Use:-
  511.          This sets the voice up to play the sound forwards or backwards. 
  512.  Flipping this quickly will result in the voice changing directions as it
  513.  plays and it can be used to do `scratch' style sounds.
  514.  
  515.  DataVox_ReadReverse
  516.  On Entry:-
  517.  R0 DataChannel
  518. `On Exit:-
  519.  R0 preserved
  520.  R1 Status of reverse flag.
  521.  Errors:-
  522.  Bad Read Reverse Channel.
  523.  Use:-
  524.          This allows you to read whether a channel has been set to reverse
  525.  play or not.
  526.  
  527.  DataVox_PitchToSample
  528.  On Entry:-
  529.  R0 Pitch
  530.  R1 System Sample speed for pitch
  531.  On Exit:-
  532.  R0 Sample speed for pitch
  533.  R1 preserved
  534.  Errors:-
  535.  Bad Pitch to Sample Pitch.
  536.  Bad Pitch to Sample sample rate.
  537.  Use:-
  538.         This converts a pitch, with a given system speed in micro seconds,
  539.  to a sample rate in micro seconds. When this is then fed to Sample to Pitch
  540.  it gives you the system speed independance. It must be noted that this is a
  541.  `lossy' conversion and exact pitching speeds will be lost. However most 
  542.  times the approximation will be so close no discernable difference will
  543.  be observed. Giving a system speed of zero will cause DataVox to use its
  544.  copy of what the system speed is. Read the comments on the next SWI for
  545.  an explanation as to why this is important.
  546.  
  547.  DataVox_SampleToPitch
  548.  On Entry:-
  549.  R0 Sample Speed (micro seconds)
  550.  R1 System Speed (mirco seconds)
  551.  On Exit:-
  552.  R0 Pitch (-&7FFF - &7FFF)
  553.  R1 preserved
  554.  Errors:-
  555.  Bad Sample Speed.
  556.  Bad System Speed.
  557.  Use:-
  558.       This converts a system speed and sample speed pair into a sound pitch
  559.  value that will cause the sound to be played correctly at that system speed.
  560.  The conversion is what gives DataVox its system speed independance. If the
  561.  system speed is 0 then DataVox will use its own copy of the current system
  562.  speed. Because DataVox only updates its copy of what the System Speed is
  563.  everytime a sound is played then it can get very out of sync with what
  564.  the real system speed is. The upshot of this is that if you use the
  565.  Sample to Pitch SWI to get the right pitch to feed into DataVox you
  566.  could end up setting the pitch (correctly for the current system speed)
  567.  but have DataVox readjust it incorrectly when it recalibrates to adjust
  568.  to the `new' system speed. So this giving a system speed of zero to this
  569.  SWI automatically fills in the system speed for you with DataVox's copy of 
  570.  the system speed so that when it comes time to recalibrate DataVox will
  571.  adjust everything correctly. When wanting to use DataVox's system speed
  572.  independance it is reccomended that you use this SWI with the System Speed
  573.  set to zero. Also setting R1 to zero recalibrates DataVox's copy of the
  574.  System Speed.
  575.  
  576.  DataVox_Duplicate
  577.  On Entry:-
  578.  R0 Source DataChannel
  579.  R1 Destination DataChannel
  580.  On Exit:-
  581.  R0,R1 preserved
  582.  Errors:-
  583.  Bad Duplicate Channel.
  584.  Silly. Why are you trying to Duplicate to the same channel?
  585.  Use:-
  586.       This copies all the settings of one DataChannel to another. This 
  587.  allows you to easily have channels that share the same piece of sampled
  588.  data without much mucking about. Especially given the fact that this
  589.  will always copy any new flags/settings I may add in the future.
  590.  
  591.  DataVox_Unset
  592.  On Entry:-
  593.  R0 DataChannel
  594.  On Exit:-
  595.  R0 Preserved
  596.  Errors:-
  597.  Bad Unset Channel.
  598.  Use:-
  599.       This completely clears and blanks a channel. Upon exit the selected
  600.  channel will not have any settings at all having returned to the default
  601.  state. If the channel being unset is playing then play will be terminated.
  602.  
  603.  DataVox_ConvertByte
  604.  On Entry:-
  605.  R0 Byte to Convert
  606.  R1 Datatype the byte is. (0,1,2 or 3 as per DataVox_Type)
  607.  R2 Type to convert the byte to. (0,1,2 or 3 as per DataVox_Type)
  608.  On Exit:-
  609.  R0 The Converted Byte
  610.  R1,R2 preserved
  611.  Errors:-
  612.  I can't convert this. It isn't a byte!
  613.  Bad Convert Byte Source type.
  614.  Bad Convert Byte Convert to type.
  615.  Use:-
  616.       This SWI converts a byte from a particular data type to another type.
  617.  It is perfectly acceptable to specify identical types in R1 & R2, all that
  618.  will happen is that you get the same byte back again. Please Note converting
  619.  between a Logarthimic DataType and a Linear DataType is *lossy*. The
  620.  converted sound will replay almost identically but it will not convert back
  621.  to its original form!
  622.  
  623.  DataVox_ReadBufferFlag
  624.  On Entry:-
  625.  R0 DataChannel to read
  626.  On Exit:-
  627.  R0 The Flag in the lowest bit.
  628.  Errors:-
  629.  Bad Read Buffer Flag Channel.
  630.  Use:-
  631.       Every time the Channel loads the Repeat start and end pointers this 
  632.    flag will be toggled. Once the pointers are loaded they are stored in
  633.    the Voices SCCB and so can be changed safely so that at next loading
  634.    of them they can point to a new area. This SWI allows you to follow
  635.    the loading of these pointers and if you wish to you can do some
  636.    clever buffering for activities like playing samples from disk or
  637.    playing compressed samples. *PLEASE NOTE* I make no guarantees that
  638.    the bit you get back will be set or unset at any particular point
  639.    in time. What I do guarantee is that the bit will change state as
  640.    the pointers are loaded.
  641.  
  642.  DataVox_AllocateChannel
  643.  On Entry:-
  644.  R0 Unique key.
  645.  On Exit:-
  646.  R0 DataChannel assigned if succesful, 0 otherwise.
  647.  Errors:-
  648.  Bad Allocate Channel Key!
  649.  Use:-
  650.       This allows you to request a channel from DataVox that is free. If 
  651.     there are no free channels then 0 is returned. No assumptions can be
  652.     made about which channel will be handed back as this will vary from
  653.     moment to moment depending on how many other applications are using
  654.     the module. Also DataVox will not ensure that the channel is active
  655.     or assigned to itself by the Sound System of the Arc. That is comp-
  656.     letely the applications responsibility as there are too many variables
  657.     for this module to cater for in a tidy fashion.
  658.       The Unique key is the key needed to DeAllocate or Request this channel
  659.     again. This key is needed to do the deallocate or request simply to
  660.     allow the application that has been allocated the channel the knowledge
  661.     that it is, as far as DataVox is concerned, the only owner of that
  662.     channel. It also prevents careless applications from deallocating
  663.     another applications channel. This is crucial to the safe multi-tasking
  664.     of this module as it provides a measure of security allowing an 
  665.     application to know for sure that it can do what it likes with the
  666.     settings of a particular channel and not upset any other application's
  667.     use of the module.
  668.       Of course, due to other considerations, there is nothing to stop
  669.     a badly programmed application from just using the SWI's to re-assign
  670.     the other channels as it wishes so tasks *must* ensure their channel
  671.     is set correctly before use. Whether this requires constant monitoring
  672.     or simply checking just before use is application dependant. Due to
  673.     problems of the ownership of channels by loading modules and maintaining
  674.     backwards compatability this `hole' (More like a subway tunnel!) in
  675.     channel security will *not* be fixed.
  676.  
  677.  DataVox_DeAllocateChannel
  678.  On Entry:-
  679.  R0 DataChannel to free
  680.  R1 Unique key to channel
  681.  On Exit:-
  682.  R0 preserved
  683.  R1 preserved
  684.  Errors:-
  685.  Bad DeAllocate Channel Channel.
  686.  Bad DeAllocate Channel Key!
  687.  Use:-
  688.       This SWI will return, if the passed key is correct, the designated
  689.     channel back to the free 'pool' of channels in DataVox allowing another
  690.     application the chance to use it. This SWI will not disrupt the settings
  691.     of the channel allowing applications to 'trade' channels if they so
  692.     desire. Of course any such scheme must *not* rely totally on getting
  693.     the channel and have code to cope with this contingency.
  694.  
  695.  DataVox_RequestChannel
  696.  On Entry:-
  697.  R0 DataChannel desired
  698.  R1 Unique key for it
  699.  On Exit:-
  700.  R0 0 if request denied else preserved
  701.  R1 preserved
  702.  Errors:-
  703.  Bad Request Channel Channel!
  704.  Use:-
  705.       If an application simply must have a particular channel then it can
  706.     request for it. If the channel is free then the SWI will hand back the
  707.     channel number and mark the channel as allocated with the key passed.
  708.     If the channel is already allocated but the key passed matches the key
  709.     given then the channel is handed back as DataVox considers that the
  710.     application requesting it already `owns' it. Otherwise the request is
  711.     denied by the SWI handing back a 0 as the channel. It is expected that
  712.     applications be nice and actually respect this denial.
  713.  
  714.  DataVox_ChannelsFree
  715.  On Entry:-
  716.  R0 Undefined
  717.  R1 Undefined
  718.  On Exit:-
  719.  R0 Number of unallocated channels available.
  720.  R1 Number of allocated channels.
  721.  Errors:-
  722.  None
  723.  Use:-
  724.       What can be said about this one that isn't obvious? This returns the
  725.     total number of free channels for use and the total number in use.
  726.  
  727.  DataVox_ConvertArea
  728.  On Entry:-
  729.  R0 Start Address
  730.  R1 End Address
  731.  R2 Datatype the byte is. (0,1,2 or 3 as per DataVox_Type)
  732.  R3 Type to convert the byte to. (0,1,2 or 3 as per DataVox_Type)
  733.     OR an address to a 256 byte lookup table.
  734.  On Exit:-
  735.  R0-R3 preserved
  736.  Errors:-
  737.  Your Start Address is below your End Address for conversion.
  738.  Bad Convert Area Type.
  739.  Bad Type to Convert Area to!
  740.  Use:-
  741.       This functions like Convert Byte only instead of converting a Byte
  742.     it converts a chunk of memory at a go. This will be much faster then
  743.     doing a byte by byte conversion of the area in your own code as it
  744.     will not have to go through the high overhead that a SWI call entails
  745.     for every byte.
  746.       If you specify an address in R3 then the type in R2 is ignored and it
  747.     is assumed that the lookup table is adjusted to cope with the datatype
  748.     being converted. Please note R2 in this mode may be used at a later date
  749.     by this code for a special meaning and should be by default set to zero
  750.     in this conversion mode.
  751.       The same comments about conversion restrictions in ConvertByte apply
  752.     here.
  753.  
  754.  DataVox_ChannelFreeMap
  755.  On Entry:-
  756.  R0 undefined
  757.  On Exit:-
  758.  R0 Bitmap of the free channels.
  759.  Errors:-
  760.  None
  761.  Use:-
  762.       This SWI returns a bitmap of the free channels. If the bit is set then
  763.     the channel is allocated else it is free. Bit Zero applies to channel 1,
  764.     Bit One applies to channel 2 etc... I provided this SWI a) because I 
  765.     needed it for one of my applications, b) to allow an application to
  766.     easily monitor the free channels & c) I realised that I had not provided
  767.     any way of non-destructively querying whether a channel is free or not.
  768.     As there are currently only 8 channels supported by the VIDC then only
  769.     the low eight bits will hold meaningful values. However the higher bits
  770.     are by default cleared and no assumptions about their state should be
  771.     made in case a future machine is released with more sound channels
  772.     supported. As an aside you can easily find out the total number of 
  773.     channels available by calling this SWI counting the number of bits set
  774.     and the querying the number of channels free and totalling the two
  775.     results. Of course it is far simpler to simply total the two registers
  776.     passed back by ChannelsFree SWI. I consider it unlikely that more than
  777.     32 channels will ever be supported by future hardware I just hope Acorn
  778.     don't take this as a challenge and provide more than 32 channels! :-)
  779.  
  780.  DataVox_UpCallHandler
  781.  On Entry:-
  782.  R0 DataChannel desired
  783.  R1 Address (absolute) or the routine to be called.(0 to deinstall a handler)
  784.  R2 Private word to be passed to the routine.
  785.  On Exit:-
  786.  R0 preserved
  787.  R1 preserved
  788.  R2 preserved
  789.  Errors:-
  790.  Bad UpCall Handler Channel!
  791.  Use:-
  792.       This SWI provides a means by which special code can be added to DataVox
  793.     to allow precise control over the order in which sample buffers are 
  794.     played. The code is called under two circumstances - when a sound is
  795.     started and when a buffer has been finished. Your code is expected to
  796.     be :-
  797.          a) FAST. Speed is *very* critical in this routine. Your code will
  798.          called in IRQ mode with interupts shut off and so must be as fast
  799.          as is possible to avoid problems. 
  800.          b) always terminate. There must be absolutely no way in which your
  801.          code cannot terminate. If your code does fail to terminate then 
  802.          your machine will lock up! You have been warned...
  803.          c) well behaved. Your code is being given access to the internal
  804.          tables of DataVox and care must be taken not to damage any other
  805.          channels table entries. Do *NOT* attempt to access any of the other
  806.          channels data as this could cause your machine to crash.
  807.          d) terminate cleanly. It is expected that your code generally
  808.          obey the normal restrictions placed on interupt routines. Whatever
  809.          you do do *not* turn interupts back on or exit back to DataVox
  810.          in a processor mode different from that which DataVox called you
  811.          in.
  812.  
  813.   The code calling mechanism is as follows.
  814.    
  815.   On Entry:-
  816.    R0  reason for calling. (0-2 primary reason codes.)
  817.    R1  pointer to word for the start of buffer address.
  818.    R2  pointer to word for the end of buffer address.
  819.    R3  channel number you are being called for. (0-7)
  820.    R4  the private word passed to DataVox at installation.
  821.    R5  pointer to the phase accumulator word used by the fill code.
  822.    R6  #0 (Reason code 0 is an exception to this)
  823.    R14 return address.
  824.   On Exit:-
  825.    R0  Return Code. (0 or 1)
  826.  
  827.     Registers R0-R6 can be corrupted and R14 contains the return address.
  828.   The addresses passed in R1 & R2 are the addresses at which DataVox will
  829.   *next* load the start & end addresses of the next buffer to be played.
  830.   The passing of the channel number allows one chunk of code to handle
  831.   mulitple channels simultaneously and accordingly your code must be
  832.   re-entrant to handle this. (ie. keep your workspace seperate for each
  833.   channel.) The private word passed in R4 is what you handed to DataVox
  834.   when you installed the handler. This cannot be updated by any other means
  835.   than reinstalling the handler. It is intended that routines put into
  836.   modules use this word to point to their workspace... R5 is the phase
  837.   pitch accumulator used by DataVox in fixed pitch play. Altering this
  838.   word allows the UpCall code to alter the speed of sample play. The
  839.   data format is that returned by the SWI "Sound_Pitch". IE a fixed point 32
  840.   bit number with an 8 bit integer and 24 bits fractional data.
  841.     The reason code passed gives you an indication of why your code is
  842.   being called. 
  843.  
  844.   Code 0 indicates a start of sound synthesis/play. It is expected that 
  845.          your code set itself to appropriate default values upon receiving
  846.          this call. Also in this reason code call *alone* R6 is loaded
  847.          with DataVox's copy of what the system speed in micro seconds
  848.          is. It is expected that UpCall code use this to decide if
  849.          certain pitch tables need recalibrating for the system speed.
  850.   Code 1 indicates a normal play call. Under a reason 1 call the return code
  851.          has effect allowing the upcalled code control over when play will
  852.          halt. Returning a value of 1 indicates to DataVox that it should
  853.          play another buffer. Returning 0 indicates an immediate stop in
  854.          play.
  855.   Code 2 indicates that a timed play is underway. In this mode DataVox will
  856.          ignore the return code completely as it has control over when the
  857.          sound play will halt. It is still valid to pass a return code back
  858.          though (It just isn't used thats all....). In this mode looping
  859.          from the start may be neccessary and your code should have some
  860.          method of coping with this. Of course not altering the start &
  861.          end addresses simply means the last buffer played will be played
  862.          again....
  863.  
  864.  These three codes constitute the primary fill reason codes. All of these
  865.  routines are *highly* speed critical and should not waste any time at all
  866.  if possible! However the next few reasons codes are called in circumstances
  867.  where speed is not so critical. Longer and more complex routines can be
  868.  attempted here but again CallBack code writers should not waste time
  869.  needlessly.
  870.  
  871.   Code 3 this is the system speed recalibration code. Your callback code
  872.          will be called when DataVox detects a need to recalibrate the
  873.          system speed and gives your code a chance to do likewise. It is
  874.          expected that UpCall code will use this entry to recalibrate any
  875.          internal pitch tables they have to the new system speed. It is 
  876.          also expected that the code will adjust the phase accumulator
  877.          word and DataVox will *assume* that the UpCall code will keep
  878.          it correctly calibrated for the current system speed.
  879.          Registers:-
  880.  
  881.          R0  #3
  882.          R1  Old System Speed in micro seconds.
  883.          R2  New System Speed in micro seconds.
  884.          R3  Channel number (0-7) being recalibrated.
  885.          R4  Private UpCall Data Word.
  886.          R5  pointer to the phase accumulator word used by the fill code.
  887.          R6  #0
  888.          R14 return address.
  889.  
  890.          No return code is expected and any returned will be ignored.
  891.  
  892.   Code 4 this is the channel assignment entry code. DataVox is informing
  893.          your code of the fact that another DataVox channel has been
  894.          assigned to this code. It is expected that the code prepares
  895.          itself in whatever ways are needed to play the new channel.
  896.          Registers:-
  897.  
  898.          R0  #4
  899.          R1  pointer to word for the start of buffer address.
  900.          R2  pointer to word for the end of buffer address.
  901.          R3  System Speed in micro seconds.
  902.          R4  the private word passed to DataVox at installation.
  903.          R5  pointer to the phase accumulator word used by the fill code.
  904.          R6  #0
  905.          R14 return address.
  906.  
  907.   Code 5 DataVox is requesting that you return in R1 the sequence data the
  908.          upcall code is currently at. Obviously this is highly dependant on
  909.          how your Upcall code is organised but should usually consist of the
  910.          sequence number your code is up to. It is perfectly valid for UpCall
  911.          code to ignore this call in which case an Automatic default will be
  912.          assumed. If you are ignoring it then do not corrupt the registers
  913.          at all.
  914.          On Entry:-
  915.  
  916.          R0  #5
  917.          R1  channel number (0-7)
  918.          R2  #0
  919.          R3  #0
  920.          R4  #0
  921.          R5  #0
  922.          R6  #0
  923.          R14 return address.
  924.  
  925.          On Exit:-
  926.          
  927.          R1  UpCall pause data.
  928.  
  929.   Code 6 Here DataVox is instructing the UpCall code to commence play from
  930.          a specified point, passed in R1. It is expected that the UpCall
  931.          code will restart play from the information passed to it. If the
  932.          information is invalid it is fine for the UpCall code to ignore it
  933.          and simply play as normal. The pause data should only have effect
  934.          at the *next* start of sound play and should then be discarded.
  935.          On Entry:-
  936.  
  937.          R0  #6
  938.          R1  channel number (0-7)
  939.          R2  UpCall pause word returned by reason code 5.
  940.          R3  #0
  941.          R4  #0
  942.          R5  #0
  943.          R6  #0
  944.          R14 return address
  945.  
  946.  Your code should simply ignore any reason codes it doesn't understand and
  947.  return back to DataVox doing nothing. If your code encounters an error it
  948.  should simply unstack itself and exit cleanly rather than try to report
  949.  an error. Any such attempts *will* fail.Also your code, if it is to be used
  950.  in the Desktop, must always be paged in for DataVox to access. This means
  951.  either that it must be stored in the RMA or that it only ever gets called
  952.  while your application is currently paged in. And that about covers it.
  953.  Please be very careful with this SWI as the potential for trouble with it
  954.  is very high.
  955.  
  956.  DataVox_FlushKeys
  957.  On Entry:-
  958.  No parameters required.
  959.  On Exit:-
  960.  All registers preserved
  961.  Errors:-
  962.  none
  963.  Use:-
  964.       This SWI causes DataVox to DeAllocate all channels. This is a highly
  965.     antisocial SWI and is provided only for development work. All finished
  966.     applications should be tidy and be deallocating all their channels
  967.     themselves anyway. However when developing new software channels can
  968.     be left allocated causing DataVox to refuse to be killed. This means
  969.     you have to hard reset your machine to get rid of it - very annoying.
  970.     Under no circumstances should non-development code *ever* use this
  971.     SWI. Use of this SWI totally destroys the multi-tasking coherency of
  972.     DataVox and I will get extremely sad at code that does use it...
  973.  
  974.  DataVox_VoiceActive
  975.  On Entry:-
  976.  R0 0 to read 1 to read and set sound system.
  977.  On Exit:-
  978.  R0 Minimum number of sound channels needed active for DataVox.
  979.  Errors:-
  980.  none
  981.  Use:-
  982.       This SWI is provided to allow applications to keep the sound system at
  983.     its minimum DMA level needed to support all assigned DataVox channels.
  984.     If R0 is set to 1 on entry then not just will the minimum number be
  985.     returned but DataVox will reconfigure the sound system to ensure the
  986.     required number of voices is active. Please note it will *not* assign
  987.     these channels to the DataVox voice - merely ensure that they are active
  988.     for the application(s) to use.
  989.       Applications that wish to be `social' should use this SWI to determine
  990.     how many channels are needed and then query the sound system to see if
  991.     sufficient channels are active already. If there are sufficient channels
  992.     active then it should not alter the setting...
  993.  
  994.  DataVox_SystemSpeed
  995.  On Entry:-
  996.  R0 undefined
  997.  On Exit:-
  998.  R0 DataVox's copy of the system speed.
  999.  Errors:-
  1000.  none
  1001.  Use:-
  1002.       The SWI returns to you DataVox's copy of what the system speed current-
  1003.     ly is. This is important because DataVox can be out of sync with what
  1004.     the system speed really is and an application needs to calculate some-
  1005.     thing like duration of play. This also will trigger a recalibration if one
  1006.     is needed.
  1007.  
  1008.  DataVox_Version
  1009.  On Entry:-
  1010.  R0 undefined
  1011.  On Exit:-
  1012.  R0 Version number of DataVox * 100.
  1013.  Errors:-
  1014.  none
  1015.  Use:-
  1016.       This SWI is for informational purposes to allow applications to 
  1017.     determine what facilities are available from DataVox. This allows
  1018.     well written applications to be able to use old versions of DataVox
  1019.     and only allow/use the extended features of new versions of DataVox
  1020.     if they are available.
  1021.  
  1022.  DataVox_SlaveChannel
  1023.  On Entry:-
  1024.  R0 Channel to be slaved.
  1025.  R1 Channel it is to be slaved to.
  1026.  On Exit:-
  1027.  R0,R1 preserved.
  1028.  Errors:-
  1029.  You can't slave the same channel to itself.
  1030.  Bad channel number to slave.
  1031.  Bad channel number to be slaved to.
  1032.  You cannot have a slaved channel as a master channel!
  1033.  Use:-
  1034.       This allows you to link channels together. Please note the master channel
  1035.     is not allowed to be slaved to another channel to prevent circular list
  1036.     problems. Please note you should not slave any channels you have not
  1037.     claimed using DataVox_AllocateChannel or RequestChannel! Please note due
  1038.     to the fact that the linking code is executed by callback there will be
  1039.     a delay between channels linked. If you do not want this delay then it is
  1040.     expected that you will drive the channels yourself in unlinked mode. This
  1041.     linking is purely for wimp applications and command line users to use in
  1042.     non critical sound applications. (Like playing back their favourite
  1043.     stereo beeps...Something I am rather partial to.)
  1044.  
  1045.  DataVox_ReadMaster
  1046.  On Entry:-
  1047.  R0 Channel to read.
  1048.  On Exit:-
  1049.  R0 Master of this channel. 0 for no master.
  1050.  Errors:-
  1051.  Bad channel to read the master of!
  1052.  Use:-
  1053.       This reads the channels master and reports it back to you. It is purely
  1054.     for informational purposes.
  1055.  
  1056.  DataVox_ReadUpCallStatus
  1057.  On Entry:-
  1058.  R0 Channel to read.
  1059.  On Exit:-
  1060.  R0 The UpCall status/pause word as returned.
  1061.  Errors:-
  1062.  Bad channel number to read.
  1063.  No UpCall code to interrogate!
  1064.  Use:-
  1065.       This issues a type 5 reason code call to the UpCall code on the
  1066.     specified channel. If there is no UpCall code on the channel then the
  1067.     routine will error and R0 will be in an undefined state. Please note it is
  1068.     the UpCall code's choice as to whether to ignore this reason code or not so
  1069.     the results returned are subject to what kind of UpCall code is present.
  1070.  
  1071.  DataVox_SetUpCallStatus
  1072.  On Entry:-
  1073.  R0 Channel to affect. 
  1074.  R1 UpCall status/pause word to write.
  1075.  On Exit:-
  1076.  Registers preserved.
  1077.  Errors:-
  1078.  Bad channel number to set.
  1079.  No UpCall code to call!
  1080.  Use:-
  1081.       Basically the opposite of a ReadUpCallStatus call this issues a type 6
  1082.     reason code call to the UpCall code on the specified channel. Again it is
  1083.     at the UpCall codes discretion to acknowledge this call or not.
  1084.  
  1085.  DataVox_AdjustMemory
  1086.  On Entry:-
  1087.  R0 DataChannel
  1088.  R1 DataStart
  1089.  R2 DataEnd
  1090.  On Exit:-
  1091.  R0 preserved
  1092.  R1 preserved
  1093.  R2 preserved
  1094.  Errors:-
  1095.  Bad Adjust Memory parameters.
  1096.  Use:-
  1097.       This functions in an identical manner to SetMemory. However it does not
  1098.     reset the datatype, reverse, pitch, upcall code or any of the other myriad
  1099.     settings bar that of the Repeat start and end addresses. It is intended
  1100.     that this be useful for sound players that can addresses frequently.
  1101.  
  1102.  DataVox_SetInternalPitch
  1103.  On Entry:-
  1104.  R0 DataChannel
  1105.  R1 32 bit fractional step.
  1106.  On Exit:-
  1107.  R0 preserved
  1108.  R1 preserved
  1109.  Errors:-
  1110.  Bad Set Internal Pitch parameters.
  1111.  Use:-
  1112.       This SWI allows the user to fine tune the sample replay stepping rate. It
  1113.    only has effect when the fixed pitching mode is active and is superceded by
  1114.    any SetMemory or SetPitch commands. The number passed in R1 should be
  1115.    treated as 32 bit fixed point number comprising 8 bits integer, 24 bits
  1116.    fractional numeric representation. Use of this SWI is depreciated but may be
  1117.    necessary under extreme circumstances, I would prefer applications to go
  1118.    through SetPitch wherever possible.
  1119.  
  1120. SWI Chunk numbering
  1121. ===================
  1122.  
  1123.      Here is the table of DataVox's SWI chunk numbers on SWI names. Of course
  1124.  all names need to be preceded with `DataVox_' and the chunk range number
  1125.  is :- &44380
  1126.  
  1127.      Chunk # | SWI name
  1128.      --------+------------------
  1129.       0      | Type
  1130.       1      | Timed
  1131.       2      | Pitch
  1132.       3      | ReadPitch
  1133.       4      | ReadTimer
  1134.       5      | ReadType
  1135.       6      | SetMemory
  1136.       7      | ReadMemory
  1137.       8      | ReadAddress
  1138.       9      | SetRepeat
  1139.       10     | ReadRepeat
  1140.       11     | SetReverse
  1141.       12     | ReadReverse
  1142.       13     | PitchToSample
  1143.       14     | SampleToPitch
  1144.       15     | Duplicate
  1145.       16     | Unset
  1146.       17     | ConvertByte
  1147.       18     | ReadBufferFlag
  1148.       19     | AllocateChannel
  1149.       20     | DeAllocateChannel
  1150.       21     | RequestChannel
  1151.       22     | ChannelsFree
  1152.       23     | ConvertArea
  1153.       24     | ChannelFreeMap
  1154.       25     | UpCallHandler
  1155.       26     | FlushKeys
  1156.       27     | VoiceActive
  1157.       28     | SystemSpeed
  1158.       29     | Version
  1159.       30     | SlaveChannel
  1160.       31     | ReadMaster
  1161.       32     | ReadUpCallStatus
  1162.       33     | SetUpCallStatus
  1163.       34     | AdjustMemory
  1164.       35     | SetInternalPitch
  1165.  
  1166. Error Messages
  1167. ==============
  1168.  
  1169.    The Error range begins at &806100, ends at &80613F, and here is the error
  1170. message list.
  1171.  
  1172.    Error # | Error Message
  1173.    --------+-------------------------------------------------------------
  1174.       0    | DataVox is still being used!
  1175.       1    | Unknown DataVox operation
  1176.       2    | Bad Address Channel.
  1177.       3    | Bad Timer parameters.
  1178.       4    | Bad Reverse parameters.
  1179.       5    | Bad Settype parameters.
  1180.       6    | Bad Set Memory parameters.
  1181.       7    | Bad Set Repeat Channel.
  1182.       8    | Bad Set Repeat Memory - Start above End.
  1183.       9    | Bad Set Repeat. Voice not active.
  1184.       10   | Bad Read Pitch Channel.
  1185.       11   | Bad Read Timer Channel.
  1186.       12   | Bad Read Reverse Channel.
  1187.       13   | Bad Read Type Channel.
  1188.       14   | Bad Pitch parameters.
  1189.       15   | Bad Read Memory Channel.
  1190.       16   | Bad Pitch to Sample Pitch.
  1191.       17   | Bad Pitch to Sample sample rate.
  1192.       18   | Bad Sample Speed.
  1193.       19   | Bad System Speed.
  1194.       20   | Bad Duplicate Channel.
  1195.       21   | Silly. Why are you trying to Duplicate to the same channel?
  1196.       22   | Bad Unset Channel.
  1197.       24   | I can't convert this. It isn't a byte!
  1198.       25   | Bad Convert Byte Source type.
  1199.       26   | Bad Convert Byte Convert to type.
  1200.       27   | Bad Read Buffer Flag Channel.
  1201.       28   | Bad DeAllocate Channel Channel.
  1202.       29   | Bad DeAllocate Channel Key!
  1203.       30   | Bad Request Channel Channel!
  1204.       31   | Your Start Address is above your End Address for conversion.
  1205.       32   | Bad Convert Area Type.
  1206.       33   | Bad Type to Convert Area to!
  1207.       34   | Bad UpCall Handler Channel!
  1208.       35   | Bad Allocate Channel Key!
  1209.       36   | Bad Request Channel Key!
  1210.       37   | You can't slave the same channel to itself.
  1211.       38   | Bad channel number to slave.
  1212.       39   | Bad channel number to be slaved to.
  1213.       40   | You cannot have a slaved channel as a master channel!
  1214.       41   | Bad channel to read the master of!
  1215.       42   | Bad channel number to read.
  1216.       43   | No Upcall code to interrogate!
  1217.       44   | Bad channel number to set.
  1218.       45   | No UpCall code to call!
  1219.       46   | Bad Adjust Memory parameters.
  1220.  
  1221.  
  1222.   Version History
  1223.   =========================================================================
  1224.   |Version | Comments.                                                    |
  1225.   =========================================================================
  1226.   | 1.00   | The first DataVox Module that supported only one file,timing |
  1227.   |        |   and data types. Released into the Public Domain.           |
  1228.   |        |   (07-Nov-1990)                                              |
  1229.   | 2.00   | Major re-write of code. Now it only plays chunks of memory   |
  1230.   |        |   and doesn't handle the loading of the data. (15-Jan-1991)  |
  1231.   | 2.01 - | Expanded support to handle eight independant channels from   |
  1232.   | 2.05   |   the one voice slot. Added the incidental code to control   |
  1233.   |        |   this new feature. Tidied up the Voice Code too!            |
  1234.   |        |   (16-Jan-1991 - 01-Feb-1991)                                |
  1235.   | 2.06   | Added the DataVoxStatus feature to show all the channels     |
  1236.   |        |   status. (02-Feb-1991)                                      |
  1237.   | 2.07   | Added the code to handle fixed pitch playing! Now all sounds |
  1238.   |        |   issued from the channel can be forced to play at a preset  |
  1239.   |        |   pitch. This in particular allows voices to be slaved to    |
  1240.   |        |   beep channel and for them to play correctly rather than    |
  1241.   |        |   at a too fast rate. (03-Feb-1991)                          |
  1242.   | 2.08   | Optimised the buffer fill code and corrected for a possible  |
  1243.   |        |   error to do with buffer exit fills. I suspect that I had   |
  1244.   |        |   made a small error in the flush code that resulted in the  |
  1245.   |        |   voice continuing to 'fill' the DMA buffer after the sound  |
  1246.   |        |   data had finished but filling it with 0's,thus resulting   |
  1247.   |        |   in no noise but heavy interupt overheads when there should |
  1248.   |        |   not have been... (24-Mar-1991)                             |
  1249.   | 2.09   | Added the DataVox_ReadAddress SWI at the request of Jason    |
  1250.   |        |   Williams. And saved on 28 bytes of size due to duplicated  |
  1251.   |        |   storage space that wasn't neccessary. (08-Jun-1991)        |
  1252.   | 2.10   | Corrected the timer flag algorithm to allow for repeated play|
  1253.   |        |   of a sample up to the time limit specified. (19-Aug-1991)  |
  1254.   | 2.11   | Allowed the addition of repeated play blocks. This allows    |
  1255.   |        |   samples to have a lead in and then a long repeated section |
  1256.   |        |   if so desired. Useful for coding music players.            |
  1257.   |        |   (19-Aug-1991)                                              |
  1258.   | 2.12   | Added reverse play code! Now you can play your samples either|
  1259.   |        |   way! The repeat loops even will be played in reverse.      |
  1260.   |        |   (20-Aug-1991)                                              |
  1261.   | 3.00   | Finally got the errors, with Julians help, out of the system |
  1262.   |        |   speed independance code. Now you can screw with the system |
  1263.   |        |   speed (Yuck!) and it will attempt to play the sample at the|
  1264.   |        |   right pitch. (26-Aug-1991)                                 |
  1265.   | 3.01   | Fixed a minor error in the Reverse play code. Now it reverses|
  1266.   |        |   properly if the sound is already playing. (28-Aug-1991)    |
  1267.   | 3.02   | Added the Unset and Duplicate code. Now you can very simply  |
  1268.   |        |   clear and copy the settings of any channel. (28-Aug-1991)  |
  1269.   | 3.03   | Fixed an Underflow/Overflow error with the conversion SWI's. |
  1270.   |        |   now only sensible values can be returned by it. Before     |
  1271.   |        |   values large and smaller than possible pitches were being  |
  1272.   |        |   returned. (28-Aug-1991)                                    |
  1273.   | 3.04   | Fixed an embarrising error in the `DataVox_SampleToPitch'    |
  1274.   |        |   SWI.. guess who got a compare the wrong way round...       |
  1275.   |        |   One of these days I guess I will just have to learn how to |
  1276.   |        |   code in assembler. :-). (28-Aug-1991)                      |
  1277.   | 3.05   | Removed an unnecessary SWI and upgraded two other SWI's to   |
  1278.   |        |   take its place. (29-Aug-1991)                              |
  1279.   | 3.06   | Fixed a bug in the smooth update code :- There wasn't any!   |
  1280.   |        |   This caused problems in the usage of volumes from &180 to  |
  1281.   |        |   &1FF. (29-Aug-1991)                                        |
  1282.   | 3.07   | Fixed a bug in the Set Repeat Code. (31-Aug-1991)            |
  1283.   | 3.08   | Fixed a minor bug in the Set Pitch Code. It wasn't clearing  |
  1284.   |        |   the sample rate table. Not harmful just untidy.            |
  1285.   |        |   (31-Aug-1991)                                              |
  1286.   | 3.09   | Added the ConvertByte SWI. My thanks to Edourard Poor &      |
  1287.   |        |   Julian Wright for the algorithm for converting Logarithmic |
  1288.   |        |   to Linear samples. (01-Sep-1991)                           |
  1289.   | 3.10   | Extended the SetRepeat SWI to allow for clever buffering     |
  1290.   |        |   tricks and added the ReadBufferFlag SWI to help with this. |
  1291.   |        |   (08-Sep-1991)                                              |
  1292.   | 3.11   | Added the extra SWI's for multitasking support. This now     |
  1293.   |        |   allows applications to `share' DataVox in a consistant     |
  1294.   |        |   way. (14-Sep-1991)                                         |
  1295.   | 3.12   | Added the ConvertArea SWI to allow fast Sample conversion    |
  1296.   |        |   when needed. (03-Oct-1991)                                 |
  1297.   | 3.13   | Added the ChannelFreeMap SWI to allow better channel         |
  1298.   |        |   allocation monitoring by tasks. (11-Oct-1991)              |
  1299.   | 3.14   | Adjusted the Type SWI to only have effect at the next start  |
  1300.   |        |   of play buffer fill. This cures a few problems with file   |
  1301.   |        |   overlay code... (12-Oct-1991)                              |
  1302.   | 3.15   | Added the UpCallHandler SWI. This now allows code quite fine |
  1303.   |        |   control over how sounds are played in DataVox.             |
  1304.   |        |   (15-Oct-1991)                                              |
  1305.   | 3.16   | Altered DataVox so that it now refuses to be killed till all |
  1306.   |        |   tasks using it have DeAllocated themselves. (15-Oct-1991)  |
  1307.   | 3.17   | Extended the kill system to allow the module to be RMTidied  |
  1308.   |        |   while tasks are using it while still remembering all the   |
  1309.   |        |   data. (16-Oct-1991)                                        |
  1310.   | 3.18   | Added the FlushKeys SWI for developers to use. This has      |
  1311.   |        |   become rather neccessary when DataVox refuses to die until |
  1312.   |        |   all channels are deallocated. (16-Oct-1991)                |
  1313.   | 3.19   | I quad word aligned the voice code to try and keep the IRQ   |
  1314.   |        |   load down as much as possible. DataVox does tend to suck   |
  1315.   |        |   bandwidth a bit... (17-Oct-1991)                           |
  1316.   | 3.20   | Further optimisations in the Fill code to keep the IRQ load  |
  1317.   |        |   down. (17-Oct-1991)                                        |
  1318.   | 3.21   | Fine tuning optimisation in the Fill code. Now the worst case|
  1319.   |        |   fill loop is five instructions per byte with the best case |
  1320.   |        |   four instructions per byte. This is about all the optimis- |
  1321.   |        |   ation I can make in the Fill code loop itself.             |
  1322.   |        |   (17-Oct-1991)                                              |
  1323.   | 3.22   | Extended the UpCall SWI to provide support for modules via   |
  1324.   |        |   a private word. (17-Oct-1991)                              |
  1325.   | 3.23   | Extended the ChannelsFree SWI to be slightly more detailed.  |
  1326.   |        |   (18-Oct-1991)                                              |
  1327.   | 3.24   | Extended the UpCall to pass the internal phase accumulator   |
  1328.   |        |   used by the fill code. (19-Oct-1991)                       |
  1329.   | 3.25   | Extended the Convert Area SWI to allow user defined lookup   |
  1330.   |        |   conversion tables. (25-Oct-1991)                           |
  1331.   | 3.26   | Added the VoiceActive SWI to allow applications to ensure the|
  1332.   |        |   sound system is sufficiently active to support all DataVox |
  1333.   |        |   assigned voices. (02-Nov-1991)                             |
  1334.   | 3.27   | Added two very small SWI's that allow a little more status   |
  1335.   |        |   reading of DataVox :- Version & SystemSpeed SWIs.          |
  1336.   |        |   (03-Nov-1991)                                              |
  1337.   | 3.28   | Corrected the Fill code to cope with timed play buffer sizes |
  1338.   |        |   smaller than the DMA buffer size. (03-Nov-1991)            |
  1339.   | 3.29   | Extended the Reason 0 (Init) UpCall code to load R6 with the |
  1340.   |        |   system sample speed. (04-Nov-1991)                         |
  1341.   | 3.30   | We have now acheived *full* system speed independance! Now   |
  1342.   |        |   the sound will adjust *with* the system if someone changes |
  1343.   |        |   it! (13-Nov-1991)                                          |
  1344.   | 3.31   | Mu Law datatype play has been added giving a fourth type that|
  1345.   |        |   DataVox understands. Now if only I had a sample or two to  |
  1346.   |        |   test these routines out on.... (14-Nov-1991)               |
  1347.   | 3.32   | Added a small bit to the pitch recalculation routines to help|
  1348.   |        |   prevent it being used when it is an undefined state. This  |
  1349.   |        |   should help with interupt usage of DataVox....             |
  1350.   |        |   (14-Nov-1991)                                              |
  1351.   | 3.33   | Fixed the recalibration code to prevent it being called with |
  1352.   |        |   invalid speeds and thus corrupting the pitch tables....    |
  1353.   |        |   (15-Nov-1991)                                              |
  1354.   | 3.34   | Corrected the Conversion code so conversion to and from Mulaw|
  1355.   |        |   now works properly. (16-Nov-1991)                          |
  1356.   | 3.35   | Added the SlaveChannel SWI and corrected a bug in the Reverse|
  1357.   |        |   SWI's code. (17-Nov-1991)                                  |
  1358.   | 3.36   | Fixed the Slaving code to work and updated the DataVoxStatus |
  1359.   |        |   command to cope with it. Added the ReadMaster SWI to allow |
  1360.   |        |   apps to monitor/control the slaving. (18-Nov-1991)         |
  1361.   | 3.37   | Fixed the VoiceActive SWI to correct a very embarrising      |
  1362.   |        |   error with it... It now works properly! (23-Nov-1991)      |
  1363.   | 3.38   | Adjusted the SampleToPitch SWI to recalibrate DataVox's      |
  1364.   |        |   idea of what the system speed is if R1 is 0 on Entry.      |
  1365.   |        |   (27-Nov-1991)                                              |
  1366.   | 3.39   | Fixed the Unset SWI to halt play if the channel being unset  |
  1367.   |        |   is playing at the time of being unset. (29-Nov-1991)       |
  1368.   | 3.40   | Corrected a couple of errors in the unset code introduced in |
  1369.   |        |   version 3.39. (1-Dec-1991)                                 |
  1370.   | 3.41   | Added two new reason codes to the UpCall system in prepera-  |
  1371.   |        |   tion for a standard UpCall file format. (12-Dec-1991)      |
  1372.   | 3.42   | Altered the fill code to fill in a byte wise fashion. This   |
  1373.   |        |   should considerably improve repeating play performance.    |
  1374.   |        |   (15-Dec-1991)                                              |
  1375.   | 3.43   | Corrected a few minor errors in a data-table and corrected an|
  1376.   |        |   error in the style of coding in error reporting...which    |
  1377.   |        |   saved some 200 bytes of space.... (16-Dec-1991)            |
  1378.   | 3.44   | Fixed errors in the newer Upcall code sections. (13-Jan-1992)|
  1379.   | 3.45   | 'Fixed' an error in the Upcall code system introduced in     |
  1380.   |        |   v3.42. However I am not happy with the fix as the code it  |
  1381.   |        |   'fixes' should work.... (16-Jan-1992)                      |
  1382.   | 3.46   | Corrected the Current Address routines to set the address up |
  1383.   |        |   at the start of sound play without waiting a DMA buffer    |
  1384.   |        |   fill. (20-Jan-1992)                                        |
  1385.   | 3.47   | Corrected an error in the Unset SWI routine that could have  |
  1386.   |        |   caused trouble.... Also modified it to not call its own SWI|
  1387.   |        |   routines via a SWI call but via a BL. This should improve  |
  1388.   |        |   its speed slightly. (2-Feb-1992)                           |
  1389.   | 3.48   | Various bug fixes to the UpCall code section. All now appears|
  1390.   |        |   to work as it should. (13-Feb-1992)                        |
  1391.   | 3.49   | Fixed a bug introduced by the UpCall code bug fixes.... Added|
  1392.   |        |   an upcall `pause` facility... (26-Feb-1992)                |
  1393.   | 3.50   | Received the SWI, Error and Message chunk allocations and    |
  1394.   |        |   coded them in. (18-Apr-1992)                               |
  1395.   | 3.51   | Fixed ConvertArea to full functionality. (14-Jun-1992)       |
  1396.   | 3.52   | Fixed the dynamic system speed recalibration to working order|
  1397.   |        |   after the additions made in v3.15 broke it... (Dang!)      |
  1398.   |        |   (28-Sep-1992)                                              |
  1399.   | 3.53   | Added to verify that DataVox is installed as a voice when    |
  1400.   |        |   AllocateChannel or RequestChannel is called. (09-Oct-1992) |
  1401.   | 3.54   | Added the AdjustMemory SWI with associated error message.    |
  1402.   |        |   Minor change to the Repeating pitch refresh. Major         |
  1403.   |        |   revamp of the play code to reduce bandwidth consumed by one|
  1404.   |        |   third. Also the play code now can stop and start on byte   |
  1405.   |        |   boundaries rather than word boundaries.(02-Nov-1992)       |
  1406.   | 3.55   | Added the SetInternalPitch SWI to allow for cases where      |
  1407.   |        |   extremely fine control of the replay rate is needed. Fixed |
  1408.   |        |   smooth update to not generate clicks when there is nothing |
  1409.   |        |   playing to update. Removed a redundant error message.      |
  1410.   |        |   Altered SampleToPitch to return negative pitches as needed.|
  1411.   |        |   SystemSpeed now recalibrates if needed. The internal fill  |
  1412.   |        |   code now uses 32bit fixed point values for sample replay   |
  1413.   |        |   improving the dynamic range coverage considerably.         |
  1414.   |        |   This version may break some early upcall code. Fixed the   |
  1415.   |        |   smooth update code to behave properly with respect to      |
  1416.   |        |   updating the pitch.(08-Nov-1992)                           |
  1417.   | 3.56   | Fixed the pitching commands to now accept pitches in the     |
  1418.   |        |   range -&7fff to &7fff. (26-Nov-1992)                       |
  1419.   | 3.57   | Fixed the Current Address update bug. (17-Apr-1993)          |
  1420.   | 3.58   | Fixed an error in the BufferFlag updating. Correction to     |
  1421.   |        |   buffer reloading code. (05-Jul-1993)                       |
  1422.   | 3.59   | Optimisations to the internal fill code. (2-Aug-1993)        |
  1423.   | 3.60   | Corrections to the Fill stopping code to prevent sample      |
  1424.   |        |   overflow. (7-Aug-1993)                                     |
  1425.   | 3.61   | Adjusted the repeating code to clear the phase accumulator.  |
  1426.   |        |   Corrected the fill code to correctly keep the phase        |
  1427.   |        |   accumulator across buffer fills. Altered the fill code to  |
  1428.   |        |   hopefully finally cure the overrun problem. A nice side    |
  1429.   |        |   effect is that CPU loading is now lowered somewhat.        |
  1430.   |        |   (12-Sep-1993)                                              |
  1431.   | 3.62   | Altered the fill code to reduce the size of it at the cost   |
  1432.   |        |   of one extra S cycle instruction. This allows a much       |
  1433.   |        |   unrolling of the loop allowing up to 64 bytes of the DMA   |
  1434.   |        |   buffer to be filled per loop pass. (compared to 16 bytes   |
  1435.   |        |   with previous versions) A major side effect of which is    |
  1436.   |        |   is further reduced CPU loading. (13-Sep-1993)              |
  1437.   | 3.63   | Fixed minor error with reverse code. (18-Oct-1993)           |
  1438.   | 3.64   | Corrected a few SWIs to return flags settings like they      |
  1439.   |        |   should. (14-Dec-1993)                                      |
  1440.   | 3.65   | Altered the GateOff code to return correct status bits.      |
  1441.   |        |   Altered the fill code to remove a register stacking - minor|
  1442.   |        |   efficiency stuff. (02-Jan-1994)                            |
  1443.   | 3.66   | Corrected a few stacking errors on some error returns.       |
  1444.   |        |   (20-Jan-1994)                                              |
  1445.   | 3.67   | Adjusted the pitch values to be more correct. (25-Jun-1994)  |
  1446.   =========================================================================